<template>
	<view>
		<text>{{title}}</text>
		<button  @click="onlogin">login</button>
	</view>
</template>


<script  >
	
// 就在这里导入，放在 export default 之前
 import helper from '../../utils/helper.js'
 import api   from   '../../utils/request.js'
 import login from   '../../api/account/index.js'
 
 export default 
 {
 	data() {
 		return {
 			title:'122'
 		}
 	},
 	onLoad() {
       	
 	},
	 
 	methods: {
      onlogin(){
		  
		  let obj={
			  Account: 'admin',
			  Password: '000000',
		    	Tenant : undefined,
			  RemoteToken:undefined,			  
		  }
		  
		 // 使用 obj 作为登录参数
		 login().signIn(obj)
		   .then(response => {
			 uni.setStorageSync('token', response.access_token);
		     console.log('登录成功', response);
		   })
		   .catch(error => {
		     console.error('登录失败', error);
		   });
	  }
 	}
 }
</script>

<style>
</style>